package com.todo.biz.application.backend.controller;


import com.todo.biz.application.backend.service.CollectSetBackendService;
import com.todo.biz.iface.backend.CollectSetBackendIface;
import com.todo.biz.iface.backend.request.*;
import com.todo.biz.iface.backend.response.QueryCollectSetByConditionResp;
import com.todo.biz.iface.backend.response.QueryCollectSetDetailResp;
import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.BizResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/12/13 00:09
 * @description
 */
@RestController
@RequestMapping("/bd/bizBase/collectSet")
@Tag(name = "推荐收藏集合处理类", description = "推荐收藏集合处理类")
public class CollectSetBackendController implements CollectSetBackendIface {

    @Resource
    private CollectSetBackendService collectSetBackendService;

    @Override
    @Operation(summary = "新增推荐集合")
    @PostMapping("/insertCollectSet")
    public BizResponse<Boolean> insertCollectSet(@RequestBody InsertCollectSetReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return collectSetBackendService.insertCollectSet(req);
    }

    @Override
    @Operation(summary = "更新推荐集合")
    @PostMapping("/updateCollectSetById")
    public BizResponse<Boolean> updateCollectSetById(@RequestBody UpdateCollectSetByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return collectSetBackendService.updateCollectSetById(req);
    }

    @Override
    @Operation(summary = "多条件查询推荐集合")
    @PostMapping("/queryCollectSetByCondition")
    public BizPageResponse<QueryCollectSetByConditionResp> queryCollectSetByCondition(@RequestBody QueryCollectSetByConditionReq req) {
        if (req == null) {
            return BizPageResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizPageResponse.paramError("参数错误");
        }
        return collectSetBackendService.queryCollectSetByCondition(req);
    }

    @Override
    @Operation(summary = "启禁用推荐合集")
    @PostMapping("/enableCollectSetById")
    public BizResponse<Boolean> enableCollectSetById(@RequestBody EnableCollectSetByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return collectSetBackendService.enableCollectSetById(req);
    }

    @Override
    @Operation(summary = "更新推荐集合关联")
    @PostMapping("/updateCollectRelation")
    public BizResponse<Boolean> updateCollectRelation(@RequestBody UpdateCollectRelationReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return collectSetBackendService.updateCollectRelation(req);
    }

    @Override
    @Operation(summary = "收藏集合详情信息")
    @PostMapping("/queryCollectSetDetail")
    public BizResponse<QueryCollectSetDetailResp> queryCollectSetDetail(@RequestBody QueryCollectSetDetailReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return collectSetBackendService.queryCollectSetDetail(req);
    }
}
